<template>
	<view class="mord">
		<view class="cardBox">
			<view class="list">
				<view class="item" v-for="l in list" :key="l.card_num" @click="toDetail(l.card_num)">
					
					<view class="number">{{l.card_num}}</view>
					<view class="desc">
						<view class="text">余额</view>
						<view class="money">{{l.storage_balance}}</view>
					</view>
				</view>
			</view>
		</view>

		<navigator url="/pages/user/cardNew" class="next">
			<image src="../../static/img/3/3-39.png" mode="widthFix"></image>
			<text>添加新卡</text>
		</navigator>

	</view>
</template>

<script>
	export default {
		name: "",
		components: {

		},
		data() {
			return {
				val: '',
				tim: 0,
				list: [],
				pageIndex: 1

			}
		},
		mounted() {
			this.getData()
			// let data = {
			// 		"token" : that.$SysCache.get('token'),
			// 	     "iType": 0,
			// 	     "pageIndex": 1,
			// 	     "pageSize": 7,
			// 	     "iShopId": ""
			// }
			// this.$Request.post(
			// 	this.$api.httpApi.user.getDetail + '&token=' + that.$SysCache.get('token'), data
			// ).then(res => {
			// 	console.log(res)
			// 	this.list = res.data
			// });
		},
		onReachBottom() {
			this.getData()
		},
		methods: {
			getData(){
				let that = this
				let data = {
				
					"conditions": [{
						"name": "member_id",
						"value1": this.$SysCache.get('userInfo').id || this.$SysCache.get('userInfo').mid,
						"type": "string",
						"op": "eq"
					}],
					"pager": {
						"pageIndex": this.pageIndex,
						"pageSize": 10,
					},
					"orders": [{
						"name": "member_id",
						"order": "desc"
					}]
				}
				this.$Request.post4(
					this.$api.httpApi.user.query, data
				).then(res => {
					console.log(res)
					this.list = this.list.concat(res.data)
					this.pageIndex++
					if(res.data.length == 0){
						uni.showToast({
							title:"没有更多了！",
							icon:"none"
						})
					}
				});
			},
			toDetail(id){
				uni.navigateTo({
					url:"/pages/user/cardDetail?id="+id
				})
			}
		}


	}
</script>

<style scoped lang="less">
	.cardBox {
		width: 95%;
		margin: auto;
		border-top: 1px solid #eee;
	}

	.cardBox .list .item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 180upx;
		margin-top: 50rpx;
		overflow: hidden;
		padding: 50upx;
		background: url('https://ylres.yonyoucloud.com/mm/images/memberships/storedvalue/card-1.png');
		background-size: 100% auto;
		.number{
			color: #fff;
			font-size: 32upx;
		}
		.desc{
			color: #fff;
			text-align: right;
			.text{
				font-size: 22upx;
				opacity: 0.5;
			}
		}
	}

	uni-page-body {
		height: 100%;
	}

	.mord {
		min-height: 100%;
		background: #EEEEEE;
	}

	.next {
		display: block;
		width: 75%;
		margin: auto;
		height: 65rpx;
		background: rgba(4, 0, 0, 1);
		border-radius: 33px;
		font-size: 25rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		text-align: center;
		line-height: 60rpx;
		margin-top: 77rpx;
	}

	.next image {
		display: inline-block;
		width: 45rpx;
		vertical-align: middle;
	}

	.next text {
		display: inline-block;
		vertical-align: middle;
		margin-left: 14rpx;
	}
</style>
